package homework.test01;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.Random;

public class demo02 {
    public static void main(String[] args) {
        Random r = new Random();
        ArrayList<Integer> list = new ArrayList<>();
        for (int i = 0; i < 15; i++) {
            list.add(r.nextInt(100));
        }
        System.out.println("原始："+list);
        Collections.shuffle(list);
        System.out.println("打乱："+list);
        Collections.sort(list, (o1, o2) -> o1 - o2);
        System.out.println("升序："+list);
        Collections.sort(list, (o1, o2) -> o2 - o1);
        System.out.println("降序："+list);

    }
}
